package com.example.springbootlearn.netty.baseasr;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;

@Slf4j
@AsrClient(CodeEnum.SUIYAN_ASR)
@RequiredArgsConstructor
public class PrivateSuiyanAsrWsClient extends AsrWsbBaseClient {

    @Value("${yuyitech.asrserver.url:ws://127.0.0.1:7001/ws/v1}")
    private String txAsrWsUrl;

    @Override
    public String getWsUrl(String sessionId) {
        return txAsrWsUrl;
    }

    @Override
    protected String getInitialMessage(String sessionId) {
//        {
//    "header": {
//        "namespace": "SpeechTranscriber",
//        "name": "StartTranscription"
//    },
//    "payload": {
//        "lang_type": "zh-cmn-Hans-CN",
//        "format": "pcm",
//        "sample_rate": 16000,
//        "enable_intermediate_result": true,
//        "enable_punctuation_prediction": true,
//        "enable_inverse_text_normalization": true,
//        "max_sentence_silence": 800,
//        "enable_words":true,
//        "user_id":"conversation_001"
//    }
//}
        return null;
    }

    @Override
    protected WebSocketInfo.CloseStrategy getCloseStrategy() {
        return new WebSocketInfo.StatusCodeCloseStrategy();
    }

    // 心跳包
//    {
//        "header":{
//        "namespace":"SpeechTranscriber",
//                "name":"Ping"
//    }
//    }
}
